package com.bw.auth.controller;

import com.bw.auth.service.AuthService;
import com.bw.common.domain.User;
import com.bw.common.domain.request.JwtRequest;
import com.bw.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("auth")
@CrossOrigin
public class AuthController {

    @Autowired
    private AuthService authService;

    @PostMapping("/login")
    public Result login(@RequestBody User user){
        JwtRequest login = authService.login(user);
        return Result.success(login);
    }

}
